package top.tangyh.lamp.care.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.tangyh.basic.base.R;
import top.tangyh.basic.interfaces.echo.EchoService;
import top.tangyh.basic.base.controller.SuperController;
import top.tangyh.lamp.care.service.BGenItemDetailService;
import top.tangyh.lamp.care.entity.BGenItemDetail;
import top.tangyh.lamp.care.vo.query.GenItemDetailQueryParam;
import top.tangyh.lamp.care.vo.result.GenItemDetailMapDto;
import top.tangyh.lamp.care.vo.save.BGenItemDetailSaveVO;
import top.tangyh.lamp.care.vo.save.GenItemDetailQuickSaveParam;
import top.tangyh.lamp.care.vo.update.BGenItemDetailUpdateVO;
import top.tangyh.lamp.care.vo.result.BGenItemDetailResultVO;
import top.tangyh.lamp.care.vo.query.BGenItemDetailPageQuery;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * 通用项目配置明细表
 * </p>
 *
 * @author zqb
 * @date 2024-07-17 17:16:35
 * @create [2024-07-17 17:16:35] [zqb] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Validated
@RestController
@RequestMapping("/bGenItemDetail")
@Tag(name = "系统：通用项目明细管理")
public class BGenItemDetailController {

//    extends SuperController<BGenItemDetailService, Long, BGenItemDetail
//            , BGenItemDetailSaveVO, BGenItemDetailUpdateVO, BGenItemDetailPageQuery, BGenItemDetailResultVO>
//    private final EchoService echoService;
//    @Override
//    public EchoService getEchoService() {
//        return echoService;
//    }


    private  final BGenItemDetailService bGenItemDetailService;

    @Operation(summary ="获得通用项目明细")
    @PostMapping("/queryDetail")
    public R<List<BGenItemDetail>> queryDetail(@Valid @RequestBody GenItemDetailQueryParam param) {
        return  R.success(bGenItemDetailService.queryDetail(param));
    }

    @Operation(summary ="获得模块的所有通用项目明细")
    @PostMapping("/queryAll")
    public R<List<GenItemDetailMapDto>> queryAll(@Valid @RequestBody GenItemDetailQueryParam param) {
        return  R.success(bGenItemDetailService.queryAll(param));
    }


    @PutMapping("/quickcreate")
    public R quickcreate(@Valid @RequestBody GenItemDetailQuickSaveParam param) {
        bGenItemDetailService.quickcreate(param);
        return R.success();
    }

}


